<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 核心算法 里层循环 j=i;J<=10;j++
        var str = "";
        for (var i = 1; i <= 10; i++) { //外层循环控制行数
            for (var j = i; j <= 10; j++) { //里层循环打印的个数不一样 j=1 
                str += "★";
            }
            str += "\n"
        }
        alert(str)
    </script>
</body>

</html>